#测试首页
import self
from selenium.webdriver.common.by import By

from Common.Unity import ForumDriver


class ForumList:
    url:""
    driver = ""
    def __init__(self):
        self.url = "http://127.0.0.1:9580/index.html"
        self.driver = ForumDriver.driver
        self.driver.get(self.url)
    #测试首页（登录情况下）
    def ListTestByList(self):
        #测试首页标题是否存在

        self.driver.find_element(By.CSS_SELECTOR, "#article_list_board_title")
        #测试博客内容是否存在
        self.driver.find_element(By.CSS_SELECTOR, "#bit-forum-content > div.page-body > div > div > div > div > div")
        #测试发布帖子的按钮是否存在
        self.driver.find_element(By.CSS_SELECTOR, "#bit-forum-content > div.page-header.d-print-none > div > div > div.col-auto.ms-auto.d-print-none > div > a.btn.btn-primary.d-none.d-sm-inline-block.article_post")
        # #测试搜索框是否存在
        # self.driver.find_element(By.CSS_SELECTOR, "#body > div.page > header.navbar.navbar-expand-md.navbar-light.d-print-none > div > div > div.nav-item.d-none.d-md-flex.me-3 > div > form > div > input")
        # #测试比特论坛是否存在
        # self.driver.find_element(By.CSS_SELECTOR, "#body > div.page > header.navbar.navbar-expand-md.navbar-light.d-print-none > div > div > div.nav-item.d-none.d-md-flex.me-3 > div > form > div > input")
        # #测试头像是否存在
        # self.driver.find_element(By.CSS_SELECTOR, "#index_nav_avatar")
        # #Java
        # self.driver.find_element(By.CSS_SELECTOR, "#topBoardList > li:nth-child(2) > a > span.nav-link-title")
        # #C++
        # self.driver.find_element(By.CSS_SELECTOR, "#topBoardList > li:nth-child(3) > a > span.nav-link-title")
        # #mysql
        # self.driver.find_element(By.CSS_SELECTOR, "#topBoardList > li:nth-child(5) > a > span.nav-link-title")
        print("首页测试完成")

# ForumList:ForumList()
# ForumList.ListTestByList()
# self.driver.quit()
